<!DOCTYPE html>
<!-- saved from url=(0027)http://www.hnjyxh.com/zcfg/ -->
<html>
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <title>珍湘酒广告语投票评选 - 中国·长沙酒文化节</title>
    <meta name="keywords" content="湖南省酒业协会 酒协 湖南酒业">
    <meta name="description" content="湖南省酒业协会">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="__STATIC__/home/jquery_weui/css/weui.min.css"/>
    <link rel="stylesheet" href="__STATIC__/home/jquery_weui/css/jquery-weui.min.css"/>
    {css href="__PUBLIC__static/home/css/jquery.jcrop.min.css"}
</head>
<style>
    .weui-form-preview__btn{
        float:right;
    }
    .weui-cell.noborder:before{
        border-top:none;
    }
    .send_form{
        display: inline-block;
        padding: .1rem .6rem;
        background: #3CC51F;
        color: #fff;
        border-radius: 6px;
    }
    .send_form2{
        display: inline-block;
        padding: .1rem .6rem;
        background: #ccc;
        color: #fff;
        border-radius: 6px;
    }
    .send_form:active{
        color: #fff;
    }
</style>
<body>
<form>
    <p style="text-align:center">
        <span style="font-size:1rem;font-weight: bold">珍湘酒广告语投票评选列表</span>
    </p>
    <p style="text-align:center">
        <img src="/static/home/images/vote.png" style="width: 100%; height: auto;">
    </p>
    {foreach name="advert" item="vo"}
        <div class="weui-cell piao">
            <div class="weui-cell__bd">
                <p>{$vo.advert}</p>
            </div>
            <div class="weui-cell__ft count"><span>{$vo.count}</span>票</div>
        </div>
        <div class="weui-cell noborder">
            <div class="weui-cell__bd"></div>
            <div class="weui-cell__ft">
                <a class="send_form{foreach name='info' item='v'}{if $v eq $vo.id}2{/if}{/foreach}" href="{$vo.id}">投票</a>

            </div>
        </div>
    {/foreach}
</form>


<script src="__STATIC__/home/jquery_weui/js/jquery-2.1.4.js"></script>
<script src="__STATIC__/home/jquery_weui/js/jquery-weui.min.js"></script>
<script>
    $('.send_form2').click(function (e){
        e.preventDefault();
    })
    $(".send_form").click(function (e) {
        e.preventDefault();
        var advert_id = $(this).attr("href");
        var that=$(this);
        $.ajax({
            type : 'POST',
            url : '{:url("wine_vote")}',
            data : {advert_id:advert_id},
            dataType : 'json',
            success : function(data) {
                if(data.code == 200){
                    alert('投票成功！');
                    that.removeClass('send_form').addClass('send_form2')
//                    that.html('已投票');
                    var count = that.parent().parent().prev().find('.count span').html();
                    console.log(count);
                    count=parseFloat(count);
                    console.log(count);
                    count+=1;
                    that.parent().parent().prev().find('.count span').html(count);
//                    window.location.href="/index/activity/info/id/346.html";
                }else{
                    alert(data.msg);
                }
            }
        });
    });
</script>
</body>
</html>